﻿using BlogDemo.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace BlogDemo.Application
{
    public interface IAppService<TDto, TEntity> 
        where TDto : IDto
        where TEntity : class, IEntity
    { 
        int Add(TDto obj);
        int Update(TDto obj);
        int Remove(int id);
        TDto Get(int id);
        IEnumerable<TDto> Get(Expression<Func<TEntity, bool>> predicate);
        IEnumerable<TDto> GetAll();
        Task<int> AddAsync(TDto obj);
        Task<int> UpdateAsync(TDto obj);
        Task<int> RemoveAsync(int id);
        Task<TDto> GetAsync(int id);
        Task<IEnumerable<TDto>> GetAsync(Expression<Func<TEntity, bool>> predicate);
        Task<IEnumerable<TDto>> GetAllAsync();
    }

    public interface IAppService<TDto, TEntity, TKey>: IAppService<TDto, TEntity>
        where TDto : IDto
        where TEntity : class, IEntity, IEntity<TKey>
        where TKey : IComparable<TKey>
    {

    }
}
